package com.ponhu.ea2.goodsCenter.provider.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ponhu.ea2.entity.PhCategoryPropertyMd;
import com.ponhu.ea2.goodsCenter.provider.mapper.PhCategoryPropertyMdMapper;
import com.ponhu.ea2.goodsCenter.provider.service.PhCategoryPropertyMdService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 类目与属性关系表
 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2021-10-19
 */
@Service
public class PhCategoryPropertyMdServiceImpl
        extends ServiceImpl<PhCategoryPropertyMdMapper, PhCategoryPropertyMd>
        implements PhCategoryPropertyMdService {

    /**
     * 根据类目ID查询所有属性关系
     * @param categoryIds
     * @return
     */
    @Override
    public List<PhCategoryPropertyMd> getCategoryPropertyByCids(List<Long> categoryIds) {

        LambdaQueryWrapper<PhCategoryPropertyMd> queryWrapper = Wrappers
                .lambdaQuery(PhCategoryPropertyMd.class)
                .in(PhCategoryPropertyMd::getCategoryId, categoryIds);

        return list(queryWrapper);
    }

}
